package com.atguigu.cms.controller;

import com.atguigu.cms.entity.CrmBanner;
import com.atguigu.cms.service.CrmBannerService;
import com.atguigu.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/educms/bannerfront")
//@CrossOrigin
public class BannerController {
    @Resource
     private CrmBannerService bannerService;
    //查询所有banner
    @GetMapping("/getAllBanner")
    @ApiOperation(value = "获取首页banner")
    @Cacheable(value = "banner",key = "'getAllBanner'")
    public R getAllBanner(){
        List<CrmBanner> list= bannerService.selectAllBanner();
        return R.ok().data("list",list);
    }


}
